/*
 * @Author: moeWang
 * @Date: 2021-09-07 15:14:27
 * @LastEditTime: 2021-09-07 15:27:21
 * @LastEditors: moeWang
 * @Description: 策略模式
 * @FilePath: \front-end-design-mode\code\Strategy.js
 */
// 策略集
var strategies = {
    'S': function(num) {
        return num * 4
    },
    'A': function(num) {
        return num * 3
    },
    'B': function(num) {
        return num * 2
    },
}
// 
var calculate = function(level , num) {
    return strategies[level](num)
} 

console.log(calculate('S' , 4));
console.log(calculate('A' , 3));